package com.smdp.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 阿里云服务常量
 */
@Component
public class AliyunConstants implements InitializingBean {

    @Value("${aliyun.accessKeyId}")
    private String aliyunAccessKeyId;

    @Value("${aliyun.accessKeySecret}")
    private String aliyunAccessKeySecret;

    @Value("${aliyun.sms.codeTemplateCode}")
    private String aliyunCodeTemplateCode;

    @Value("${aliyun.sms.messageTemplateCode}")
    private String aliyunMsgTemplateCode;

    public static String ALIYUN_OPEN_APP_ID;
    public static String ALIYUN_OPEN_APP_SECRET;
    public static String ALIYUN_OPEN_TEMPLATE_CODE;
    public static String ALIYUN_OPEN_TEMPLATE_MSG;

    @Override
    public void afterPropertiesSet() {
        ALIYUN_OPEN_APP_ID = aliyunAccessKeyId;
        ALIYUN_OPEN_APP_SECRET = aliyunAccessKeySecret;
        ALIYUN_OPEN_TEMPLATE_CODE = aliyunCodeTemplateCode;
        ALIYUN_OPEN_TEMPLATE_MSG = aliyunMsgTemplateCode;
    }
}

